﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;

namespace GraduateDesign
{
    public class BombImage
    {
        public BombImage(int x, int y, int hei, int wid)
        {
            locationX = x;
            locationY = y;
            height = hei;
            width = wid;
        }
        
        public Image image;
        //对应碰撞前图片的索引值
        public int index;
        //图片高度
        public int height;
        //图片宽度
        public int width;
        //图片相对于Canvas的位置
        public int locationX;
        public int locationY;

        /// <summary>
        /// 图片向下移动
        /// </summary>
        /// <param name="bombImage"></param>
        /// <param name="speed"></param>
        public void move(Image bombImage,int speed)
        {
            Canvas.SetTop(bombImage, Canvas.GetTop(bombImage) +speed);
        }

        /// <summary>
        /// 图片逐渐透明，完全透明后移除图片
        /// </summary>
        /// <param name="bombImage"></param>
        /// <param name="bombList"></param>
        /// <param name="i"></param>
        public void Disappear(Image bombImage,List<BombImage>bombList,int i,float opacity)
        {
            if (bombImage.Opacity > 0)
            {
                bombImage.Opacity -= opacity;
            }
            else
            {
                bombList.Remove(bombList[i]);
            }
        }
    }
}
